import Action from '../core/Action';

export default class extends Action {
    constructor(duration,  option) {
        super(duration);
    }

    update(node, frame) {
        if (this.duration === 0 && !this.running) {
            return;
        }

        if (!node.locked) {
            let targetScale = (this.duration - frame) / this.duration;
            if (frame === 1) {
                targetScale = 1;
            }
            node.scaleX = targetScale;
            node.scaleY = targetScale;
            node.canvas.paint();
        }
    }
}
